#include "camera.hh"

#include <GL/glu.h>

Camera::Camera (const Vector3f& pos, Window* w) :
  pos_ (pos),
  teta (0),
  phi (0)
{
  left_.val_set (0, 1, 0);
  up_.val_set (1, 0, 0);
  forward_.val_set (0, 0, 0);
  target_.val_set (0, pos_ (1), pos (2) + 0.0125);
  time_ = 0;

  // get w params to calculate X and Y
  y_val = tan (w->fovy_get () * M_PI / 360.0);
  x_val = y_val * w->ratio_get ();
}

Camera::~Camera ()
{
}

void
Camera::view ()
{
  gluLookAt (pos_ (0), pos_ (1), pos_ (2),
	     target_ (0),
	     target_ (1),
	     target_ (2),
	     1, 0, 0);
}

Vector3f
Camera::get_forward ()
{
  return forward_;
}

void
Camera::time_set (float elapsed_time)
{
  time_ = elapsed_time;
}
